package com.compty.paint.manager;

import java.util.List;

import com.compty.core.hibernate.HibernateEntityDao;
import com.compty.core.page.Page;
import com.compty.paint.domain.AdvanceLogs;
import com.compty.paint.domain.CustomerInfo;
import com.compty.paint.service.IUserService;
import com.compty.paint.service.UserServiceFactory;

/**
 * 预存款日志
 * 
 * @author 朱庆辉
 */
public class AdvanceLogsManager extends HibernateEntityDao<AdvanceLogs> {

	
	public Page pageAdvanceLogs(int pageNo, int pageSize) {
		IUserService userService = UserServiceFactory.getUserService();
		CustomerInfo member = userService.getCurrentMember();
		Long userid = member.getId();
		String hql = "from AdvanceLogs where member_id=? ";
		Page page = super.pagedQuery(hql, pageNo, pageSize, userid);
		return page;
	}

	
	public void add(AdvanceLogs advanceLogs) {
		super.save(advanceLogs);
	}

	
	@SuppressWarnings("unchecked")
	public List listAdvanceLogsByMemberId(Long member_id) {
		String hql = "from AdvanceLogs where member_id=? order by log_id desc";
		return super.find(hql, member_id);
	}

}
